package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@LagouController
@LagouSecurity("lisi")
@LagouRequestMapping("/demo")
public class DemoController {


    @LagouAutowired
    private IDemoService demoService;


    /**
     * URL: /demo/query?name=lisi
     * @param request
     * @param response
     * @return
     */
    @LagouSecurity({"zhangsan"})
    @LagouRequestMapping("/methodAndClassSecurity")
    public String methodAndClassSecurity(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.methodAndClassSecurity();
    }

    @LagouRequestMapping("/classSecurity")
    public String classSecurity(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.classSecurity();
    }
}
